package org.sanelli.InterstellarGolf.GenericObject;

public class BoundingBox {
	private Vector2D _bb1;
	private Vector2D _bb2;
	/*P1 in alto a sinistra P2 in basso a destra*/
	/*Orientamento asse y naturale*/
	public BoundingBox() {
		this._bb1 = new Vector2D();
		this._bb2 = new Vector2D();
	}
	
	public BoundingBox(double p1x, double p1y, double p2x, double p2y) {
		super();
		this._bb1 = new Vector2D(p1x, p1y);
		this._bb2 = new Vector2D(p2x, p2y);
	}
	
	public BoundingBox(Vector2D p1, Vector2D p2) {
		super();
		this._bb1 = p1;
		this._bb2 = p2;
	}

	public Vector2D getP1() {
		return _bb1;
	}

	public void setP1(Vector2D bb1) {
		this._bb1 = bb1;
	}

	public Vector2D getP2() {
		return _bb2;
	}

	public void setP2(Vector2D bb2) {
		this._bb2 = bb2;
	}
	
	public double getRatio() {
		return (this.diffX()/this.diffY());
	}
	
	public double diffX() {
		return (this._bb2.getX() - this._bb1.getX());
	}
	
	public double diffY() {
		return (this._bb1.getY() - this._bb2.getY());
	}
	
	@Override
	public String toString() {
		return "Bounding Box: P1 " + this._bb1.toString() + " P2 " + this._bb2.toString();
	}
}
